<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">

    <ui:composition template="/WEB-INF/Templates/Template.xhtml">
        <h:outputStylesheet library="css" name="styles.css"/>
        <ui:define name="content">
            <div align="center">
                <h:form>
                    <h:dataTable cellspacing="5px" 
                                 value="#{rb.deltakere.hentEnDeltaker()}" 
                                 var="res" 
                                 border="1"
                                 styleClass="table"
                                 headerClass="tabellerOverskrift"
                                 rowClasses="oddColumn, evenColumn"
                                 captionClass="overskriftTabell"
                                 width="1000">

                        <f:facet name="caption">#{tekster.edit}</f:facet>
                        <h:column>
                            <f:facet name="header">#{tekster.edit}</f:facet>
                            <h:selectBooleanCheckbox value="#{res.editable}" onclick="submit()"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.Deltaker}</f:facet>
                            <h:outputText value="#{res.deltaker_id}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.Fornavn}</f:facet>
                            <h:inputText value="#{res.fnavn}" rendered="#{res.editable}" size="11"/>
                            <h:outputText value="#{res.fnavn}" rendered="#{not res.editable}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.Etternavn}</f:facet>
                            <h:inputText value="#{res.enavn}" rendered="#{res.editable}" size="11"/>
                            <h:outputText value="#{res.enavn}" rendered="#{not res.editable}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.adresse}</f:facet>
                            <h:inputText value="#{res.adresse}" rendered="#{res.editable}" size="35"/>
                            <h:outputText value="#{res.adresse}" rendered="#{not res.editable}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.epost}</f:facet>
                            <!--h:inputText value="#{res.epost}" rendered="#{res.editable}"/-->
                            <h:outputText value="#{res.epost}"/><!-- rendered="#{not res.editable}"/-->
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.fodtselsaar}</f:facet>
                            <h:inputText value="#{res.faar}" rendered="#{res.editable}" size="5"/>
                            <h:outputText value="#{res.faar}" rendered="#{not res.editable}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">#{tekster.kjonn}</f:facet>
                            <h:selectOneMenu rendered="#{res.editable}" value="#{res.kjonn}">
                                <f:selectItem itemValue="#{lister.hentDame_no()}" itemLabel="#{tekster.Kvinne}"/>
                                <f:selectItem itemValue="#{lister.hentMann_no()}" itemLabel="#{tekster.Mann}"/>
                            </h:selectOneMenu>
                            <h:outputText value="#{tekster.Mann}" rendered="#{res.erMann() == 1}"/>
                            <h:outputText value="#{tekster.Kvinne}" rendered="#{res.erMann() == 2}"/>
                        </h:column>
                    </h:dataTable>
                    <ui:debug hotkey="i"/>
                    <h:commandButton styleClass="send" value="#{tekster.Lagre}" action="#{rb.deltakere.save()}"/>
                    <h:commandButton styleClass="tilbake" value="#{tekster.Tilbake}" action="/index?faces-redirect=true"/>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>
</html>